'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  router.get('/', controller.home.index);
  router.get('/test', controller.test.index);

  router.get('/api/message_code', controller.user.messageCode);
  router.post('/api/login', controller.user.login);
  router.get('/api/user/info', controller.user.info);

  router.get('/api/home/banner', controller.home.banner);
  router.get('/api/home/menu', controller.home.menu);
  router.get('/api/home/nav', controller.home.nav);

  router.get('/api/product/list', controller.product.list);
  router.get('/api/product/create', controller.product.create);
  router.get('/api/classify/list', controller.product.classify);

  router.get('/api/classify/serarchKey', controller.product.serarchKey);

  router.get('/api/address/:id', controller.address.show);
  router.get('/api/address', controller.address.list);
  router.post('/api/address', controller.address.create);
  router.delete('/api/address/:id', controller.address.remove);
  router.put('/api/address/:id', controller.address.update);

  router.get('/api/car', controller.car.list);
  router.post('/api/car/add', controller.car.insert);
  router.put('/api/car', controller.car.update);
};
